#ifndef __BSP_BUZZER_H__
#define __BSP_BUZZER_H__

//=====================================================================================================
#include "struct_typedef.h"
#include "tim.h"
/*-----------------selections
--------------------------------------------------------
@brief:
*/



/*-----------------settings
--------------------------------------------------------
@brief:定时器4挂载在APB1总线上，对应的总线频率为84MHz，分频值为0，重载值为20999,通过公式计算得到PWM波的输出频率为4000Hz
*/
#define BUZZER_TIMHANDLE    (TIM_HandleTypeDef *)(&htim4)
#define BUZZER_CHANNEL      (uint32_t)TIM_CHANNEL_3

#define BUZZER_CKPSC        1000000

/*-----------------definitions
--------------------------------------------------------
@brief:
*/
#define Bass 0
#define Alto 1
#define Teble 2

#define One_Beat 1
#define One_TWO_Beat 2
#define One_FOUR_Beat 4

//=====================================================================================================

/*-----------------params
--------------------------------------------------------
@brief:
*/
typedef enum music_dir
{
    error,
    super_mario,
    lone_brave,
} music_dir_e;

/*-----------------functions
--------------------------------------------------------
@brief:
*/
//
void Buzzer_Test();
//
void Music_Select(music_dir_e dir);
void buzzer_on(uint16_t psc, uint16_t pwm);
void buzzer_set(uint32_t freq, uint32_t duty);
void buzzer_off(void);
/*-----------------API_h
--------------------------------------------------------
@brief:
*/
//

/*------------------------end-------------------------*/
#endif